package es.uned.hoomgle.hibernate.beans.impl;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;

import org.hibernate.search.annotations.Field;

import es.uned.hoomgle.hibernate.beans.impl.City;
import es.uned.hoomgle.hibernate.beans.interfaces.StateI;

@Entity
public class State implements StateI {
	
	/**
	 * @uml.property  name="id"
	 */
	@Id
	@Column
	@GeneratedValue
	private Integer id;
	/**
	 * @uml.property  name="name"
	 */
	@Column
	@Field
	private String name;
	
	@OneToMany
	private List<City> cityList;
	
	@Override
	public Integer getId() {
		return id;
	}

	@Override
	public void setId(Integer id) {
		this.id = id;
	}

	@Override
	public void setName(String name) {
		this.name = name;
	}

	@Override
	public String getName() {
		return name;
	}
    
	@Override
	public List<City> getCityList()
	{
		return cityList;
	}

	@Override
	public void setCityList(List <City> cityList) {
		this.cityList = cityList;
	}
	
	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("State [Id=");
		builder.append(getId());
		builder.append(", name=");
		builder.append(getName());
		//builder.append(", cityList=");
		//builder.append(getCityList());
		builder.append("]");
		return builder.toString();
	}
	
	
}
